package com.tulingxueyuan.order.controller;


import com.tulingxueyuan.order.feignService.StockFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    StockFeignService stockFeignService;

    @RequestMapping("/add")
    public String add(){
        System.out.println("下单成功");
        //String msg = restTemplate.getForObject("http://stock-server/stock/reduct",String.class);
        String msg = stockFeignService.reduct();
        return "Hello World" + msg;
    }
}
